package leetcode;

/**
 * @author Liangyaoyun
 */
public class leetCode11 {
    public int maxArea(int[] height) {
        //max=abs((j-i)*min(height[i],height[j]),max);
        int max = 0;
        int i = 0, j = height.length-1;
        while (i < j) {
            max = Math.max(((j - i) * Math.min(height[i], height[j])), max);
            if (height[i]>=height[j]){
                j--;
            }else {
                i++;
            }
        }
        return max;
    }
}
